"""
调用接口登录获取cookie，然后在conftest中设置以跳过页面登录
cookie中主要是两个值，guid和token
"""
from config.readconfig import ini
import requests

def get_cookie(username=ini.username,password=ini.password):
    data = {"username": username, "password": password}
    headers = {"Content-Type": "application/json","Host":"testhb.turingtopia.com",}
    req = requests.post(f"{ini.url}fnode-api/login/",json=data,headers=headers)
    guid = req.json()["data"]["guid"]
    token = req.json()["data"]["token"]
    return guid,token

guid,token = get_cookie()

if __name__ == '__main__':
    print(guid)
    print(token)
